<?php use_helper('jQuery')?>
<?php use_javascript('tiny_mce/tiny_mce.js')?>
<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>
<?php echo jq_javascript_tag()?>
    function setHtml(){
        html = tinyMCE.get("ems_footer_html").getContent();
        $("textarea#ems_footer_html").val(html);
    }
<?php jq_end_javascript_tag() ?>

<div id="main_header" class="ui-widget-header ui-corner-all">
    <h3>Editando Footer</h3>
</div>
<div id="main_content" class="ui-widget ui-widget-content ui-corner-all">
    <div class="form">
        <?php echo jq_form_remote_tag(array(
            'url'      => url_for('portal_footer_update',$form->getObject()),
            'update'   => 'main',
            'before'   => 'setHtml();hideMainContent();showLoaderMain()',
            'complete' => 'hideLoader();showMainContent()',
            'script'   => true
        )) ?>
            <input type="hidden" name="sf_method" value="put" />
            <fieldset>
                <?php echo $form->renderHiddenFields() ?>
                <?php echo $form->renderGlobalErrors() ?>
                <div class="form-row">
                    <?php echo $form['uses_banner']->renderLabel() ?>
                    <div class="form-field">
                        <?php echo $form['uses_banner']->renderError() ?>
                        <?php echo $form['uses_banner']->render() ?>
                    </div>
                </div>
                <div class="form-row">
                    <?php echo $form['uses_breadcrumb']->renderLabel() ?>
                    <div class="form-field">
                        <?php echo $form['uses_breadcrumb']->renderError() ?>
                        <?php echo $form['uses_breadcrumb']->render() ?>
                    </div>
                </div>
                <div class="form-row">
                    <?php echo $form['html']->renderLabel() ?>
                    <div class="form-field">
                        <?php echo $form['html']->renderError() ?>
                        <?php echo $form['html']->render() ?>
                    </div>
                </div>
            </fieldset>
            <div id="form_buttons" class="ui-widget">
                <input class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-button-text"
                       type="submit" value="Guardar" title="Guardar"/>
                <?php echo jq_link_to_remote(
                        '<span class="ui-button-text">Cancelar</span>',
                    array(
                        'update' => 'main',
                        'url' => url_for('portal_footer_show',$form->getObject()),
                        'before' => 'clearView();showLoaderMain();',
                        'complete' => 'hideLoader();',
                        'script' => true
                    ),
                    array(
                        'class' => 'ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only',
                        'title' => 'Cancelar'))
                ?>
            </div>
        </form>
    </div>
</div>